package com.example.ana.test;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * @author hejianglong
 * @date 2019/11/11
 */
@Component
@PropertySource(value = "classpath:config.properties")
public class A implements InitializingBean {

    private int age;

    private String name;

    @Autowired
    private B b;

    private C c;

    @Value("${test.as}")
    public String testAs;

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "A{" +
                "age=" + age +
                ", b=" + b +
                ", c=" + c +
                ", name=" + name +
                ", testAs='" + testAs + '\'' +
                '}';
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        this.age = 100;
    }

}
